@echo off
chcp 65001

:: 设置工作目录为当前目录
cd /d "%~dp0"

:: 设置 Java 环境
set JAVA_HOME=D:\Java\jdk-22.0.2
set PATH=%JAVA_HOME%\bin;%PATH%

:: 创建输出目录
if not exist "C:\Users\罗嘉毅\Desktop\JavaDoc" mkdir "C:\Users\罗嘉毅\Desktop\JavaDoc"

:: 生成文档
javadoc ^
-locale zh_CN ^
-encoding UTF-8 ^
-charset UTF-8 ^
-docencoding UTF-8 ^
-windowtitle "校园失物招领系统API文档" ^
-d "C:\Users\罗嘉毅\Desktop\JavaDoc" ^
-sourcepath "src/main/java" ^
-subpackages jsu.ljy.lostandfind ^
-author ^
-version ^
-private

if errorlevel 1 (
    echo 生成文档失败！
    pause
    exit /b 1
)

echo 文档生成成功！文档位置：C:\Users\罗嘉毅\Desktop\JavaDoc
start C:\Users\罗嘉毅\Desktop\JavaDoc\index.html
pause